﻿<%@ Page Title="" Language="C#" MasterPageFile="~/site.master" AutoEventWireup="true" CodeFile="Search.aspx.cs" Inherits="Search" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
    <script type="text/javascript" src="<%=ResolveUrl("~/Scripts/jquery.ae.image.resize.min.js") %>"></script>
    <script type="text/javascript">
        $(function () {
            //品牌目录
            $(".categories_inner .column").each(function () {
                if ($(this).find("div").length == 0) {
                    $(this).remove();
                }
            });
            updateCategories()
            $(".categories_collapse").live("click", function () {
                var categories = $(".categories");
                var iconDown = '<%=ResolveUrl("~/images/categories_collapse_down.jpg") %>';
                var iconUp = '<%=ResolveUrl("~/images/categories_collapse_up.jpg") %>';

                if (categories.height() != 16) {
                    //                    categories.empty().animate({ height: 16 }).append('<a class="categories_collapse btn" style="bottom:0;"><img src="' + icon + '" /></a>');
                    categories.animate({ height: 16 }, function () {
                        $(this).find('.categories_collapse').find('img').attr({ src: iconDown });
                    });
                }
                else {
                    //                    if (Brands.UpdateBrands()) {
                    //                        __doPostBack('UpdatePanel1', '');
                    //                    }
                    categories.animate({ height: 140 }, function () {
                        $(this).find('.categories_collapse').find('img').attr({ src: iconUp });
                    });
                }
            });


            //生成微博分享按钮
            function weibo(el, title) {
                var _w = 106, _h = 24;
                var param = {
                    url: location.href,
                    type: '5',
                    count: '', /**是否显示分享数，1显示(可选)*/
                    appkey: '', /**您申请的应用appkey,显示分享来源(可选)*/
                    title: title, /**分享的文字内容(可选，默认为所在页面的title)*/
                    pic: '', /**分享图片的路径(可选)*/
                    ralateUid: '', /**关联用户的UID，分享微博会@该用户(可选)*/
                    language: 'zh_cn', /**设置语言，zh_cn|zh_tw(可选)*/
                    rnd: new Date().valueOf()
                }
                var temp = [];
                for (var p in param) {
                    temp.push(p + '=' + encodeURIComponent(param[p] || ''))
                }
                el.append($('<iframe id="weibo" allowTransparency="true" frameborder="0" scrolling="no" src="http://hits.sinajs.cn/A1/weiboshare.html?' + temp.join('&') + '" width="' + _w + '" height="' + _h + '" style="float:right;position:relative;top:1px;"></iframe>'));
            }
            weibo($("#productlist_title"), '');

            //ellipsis
            $.utility.ellipsis({ selector: ".product .info p a", length: 30 });
            $.utility.ellipsis({ selector: ".product_right .info p a", length: 30 });

            //显示&隐藏商品状态
            $(".product .pic").mouseenter(function () {
                $(this).find(".status").hide();
            }).mouseleave(function () {
                $(this).find(".status").fadeIn();
            });

            //ellipsis
            $.utility.ellipsis({ selector: ".product .info p a", length: 30 });

            $(".pic").find("img").aeImageResize({ height: 171, width: 171 });
        });

        //Updatepanel1 更新时重新调用carouFredSel jQuery插件
        function updateCategories() {
            $(".categories_inner").carouFredSel({
                width: 970,
                items: { visible: 5,
                    width: 190,
                    height: 140
                },
                auto: { pauseOnHover: "resume", duration: 700 },
                prev: { button: $(".categories_prev") },
                next: { button: $(".categories_next") }
            });
        }     
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <asp:ScriptManager ID="ScriptManager1" runat="server" EnableScriptGlobalization="true" EnableScriptLocalization="true" AsyncPostBackTimeout="36000">
    </asp:ScriptManager>
    <!--品牌分类-->
    <div class="categories block">
        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
            <ContentTemplate>
                <ul class="categories_inner">
                    <li class="column">
                        <script type="text/javascript">
                            //                            Sys.Application.add_load(updateCategories);
                        </script>
                        <asp:Repeater ID="rptCategories" runat="server" OnItemCommand="rptCategories_ItemCommand">
                            <ItemTemplate>
                                <div>
                                    <asp:LinkButton ID="lbtnCategory" runat="server" CommandName="CATEGORY_CHANGE" CommandArgument='<%#Eval("BrandID").ToString()%>' Text='<%#HttpUtility.HtmlEncode(Eval("BrandName").ToString())%>'></asp:LinkButton></div>
                                <%# ((Container.ItemIndex+1) % 3 == 0 )? "</li><li class='column'>" :""%>
                            </ItemTemplate>
                        </asp:Repeater>
                    </li>
                </ul>
            </ContentTemplate>
        </asp:UpdatePanel>
        <a class="categories_prev btn"></a><a class="categories_next btn"></a><a class="categories_collapse btn">
            <img src='<%=ResolveUrl("~/images/categories_collapse_up.jpg") %>' />
        </a>
    </div>
    <!--商品列表-->
    <h1 id="productlist_title" class="title">
        <span><asp:Localize ID="Localize3" Text='<%$ Resources: ResourceGlobal, Search_Title  %>' runat="server"></asp:Localize></span>
        <a target="_blank" href="http://wpa.qq.com/msgrd?v=3&uin=4467191&site=qq&menu=yes" class="float_r">
            <img border="0" src="http://wpa.qq.com/pa?p=2:4467191:41" alt="点击这里给我发消息" title="点击这里给我发消息">
        </a>
    </h1>
    <div class="clearfix">
        <div class="productlist_wrap">
            <asp:UpdatePanel ID="UpdatePanel2" runat="server">
                <ContentTemplate>
                    <div class="productlist block clearfix">
                        <asp:Repeater ID="rptProducts" runat="server">
                            <ItemTemplate>
                                <div class="product <%#((Container.ItemIndex+1) % 4 == 0 )? "last" :"" %>">
                                    <div class="pic"><i></i>
                                        <a href='<%#ResolveUrl("~/Products/"+Eval("ProductID").ToString()) %>'>
                                            <img src='<%#ResolveUrl(Eval("Image174").ToString()) %>' 
                                                border="0" /></a><span class="status"><img src='<%#GetProductStatus(Convert.ToInt32(Eval("Status"))) %>' /></span></div>
                                    <div class="info">
                                        <p><a href='<%#ResolveUrl("~/Products/"+Eval("ProductID").ToString()) %>'><%#HttpUtility.HtmlEncode(Eval("ProductName").ToString())%></a></p>
                                        <%if (System.Globalization.CultureInfo.CurrentCulture.Name.ToLower() == "zh-cn")
                                            { %>
                                            <p><span style='<%#Convert.ToInt32(Eval("SalePrice"))!=0?"text-decoration: line-through;":string.Empty%>'><%#(Convert.ToInt32(Eval("UnitPrice")) != 0) ? string.Format("{0:C}", Eval("UnitPrice")) : Resources.ResourceGlobal.Product_Ask%></span><span class="saleprice"><%#Convert.ToInt32(Eval("SalePrice"))!=0?string.Format("{0:C}",Eval("SalePrice")):string.Empty%></span></p>
                                        <%}
                                            else if (System.Globalization.CultureInfo.CurrentCulture.Name.ToLower() == "en-us")
                                            {%>
                                            <p><span style='<%#Convert.ToInt32(Eval("SalePriceUS"))!=0?"text-decoration: line-through;":string.Empty%>'><%#(Convert.ToInt32(Eval("UnitPriceUS")) != 0) ? string.Format("{0:C}", Eval("UnitPriceUS")) : Resources.ResourceGlobal.Product_Ask%></span><span class="saleprice"><%#Convert.ToInt32(Eval("SalePriceUS"))!=0?string.Format("{0:C}",Eval("SalePriceUS")):string.Empty%></span></p>
                                        <%}
                                            else if (System.Globalization.CultureInfo.CurrentCulture.Name.ToLower() == "ja-jp")
                                            {%>
                                            <p><span style='<%#Convert.ToInt32(Eval("SalePriceJP"))!=0?"text-decoration: line-through;":string.Empty%>'><%#(Convert.ToInt32(Eval("UnitPriceJP")) != 0) ? string.Format("{0:C}", Eval("UnitPriceJP")) : Resources.ResourceGlobal.Product_Ask%></span><span class="saleprice"><%#Convert.ToInt32(Eval("SalePriceJP"))!=0?string.Format("{0:C}",Eval("SalePriceJP")):string.Empty%></span></p>
                                        <%} %>
                                    </div>
                                </div>
                            </ItemTemplate>
                        </asp:Repeater>
                    </div>
                    <div class="pager margin10_tb">
                        <asp:Repeater ID="rptPageFliper" runat="server">
                            <ItemTemplate>
                                <span class='<%#(((PageNumberItem)Container.DataItem).IsCurrentPage) ? "current": string.Empty%>'>
                                    <asp:LinkButton ID="lbtnPager" runat="server" CommandName="<%# ((PageNumberItem)Container.DataItem).PageNumberCommand%>"
                                        Text="<%# ((PageNumberItem)Container.DataItem).PageNumberText%>" Enabled='<%# !(((PageNumberItem)Container.DataItem).IsCurrentPage) %>'
                                        Font-Underline="false"></asp:LinkButton>
                                </span>
                            </ItemTemplate>
                        </asp:Repeater>
                    </div>
                    <asp:Panel ID="panelEmpty" runat="server" Visible="false">
                        <div style="border-bottom:1px solid #ccc;border-top:1px solid #ccc;height:300px; padding:10px;">
                            <asp:Localize ID="Localize2" Text='<%$ Resources: ResourceGlobal, Note_NoResult  %>' runat="server"></asp:Localize>
                        </div>
                    </asp:Panel>
                </ContentTemplate>
            </asp:UpdatePanel>
        </div>
        <!--右侧-->
        <div class="rightbar block">
            <!--右侧最新商品-->
            <div class="newproducts_title"><asp:Localize ID="Localize1" Text='<%$ Resources: ResourceGlobal, Brand_NewProducts_Title  %>' runat="server"></asp:Localize></div>
            <asp:Repeater ID="rptNewProducts" runat="server">
                <ItemTemplate>
                    <div class="product_right">
                        <div class="pic"><i></i><a href='<%#ResolveUrl("~/Products/"+Eval("ProductID").ToString()) %>'><img src='<%#ResolveUrl(Eval("Image100").ToString()) %>' border="0" /></a></div>
                        <div class="info">
                            <p><a href='<%#ResolveUrl("~/Products/"+Eval("ProductID").ToString()) %>'><%#HttpUtility.HtmlEncode(Eval("ProductName").ToString())%></a></p>
                            <%if (System.Globalization.CultureInfo.CurrentCulture.Name.ToLower() == "zh-cn")
                                { %>
                                <p><span style='<%#Convert.ToInt32(Eval("SalePrice"))!=0?"text-decoration: line-through;":string.Empty%>'><%#(Convert.ToInt32(Eval("UnitPrice")) != 0) ? string.Format("{0:C}", Eval("UnitPrice")) : Resources.ResourceGlobal.Product_Ask%></span><span class="saleprice"><%#Convert.ToInt32(Eval("SalePrice"))!=0?string.Format("{0:C}",Eval("SalePrice")):string.Empty%></span></p>
                            <%}
                                else if (System.Globalization.CultureInfo.CurrentCulture.Name.ToLower() == "en-us")
                                {%>
                                <p><span style='<%#Convert.ToInt32(Eval("SalePriceUS"))!=0?"text-decoration: line-through;":string.Empty%>'><%#(Convert.ToInt32(Eval("UnitPriceUS")) != 0) ? string.Format("{0:C}", Eval("UnitPriceUS")) : Resources.ResourceGlobal.Product_Ask%></span><span class="saleprice"><%#Convert.ToInt32(Eval("SalePriceUS"))!=0?string.Format("{0:C}",Eval("SalePriceUS")):string.Empty%></span></p>
                            <%}
                                else if (System.Globalization.CultureInfo.CurrentCulture.Name.ToLower() == "ja-jp")
                                {%>
                                <p><span style='<%#Convert.ToInt32(Eval("SalePriceJP"))!=0?"text-decoration: line-through;":string.Empty%>'><%#(Convert.ToInt32(Eval("UnitPriceJP")) != 0) ? string.Format("{0:C}", Eval("UnitPriceJP")) : Resources.ResourceGlobal.Product_Ask%></span><span class="saleprice"><%#Convert.ToInt32(Eval("SalePriceJP"))!=0?string.Format("{0:C}",Eval("SalePriceJP")):string.Empty%></span></p>
                            <%} %>
                        </div>
                    </div>
                </ItemTemplate>
            </asp:Repeater>
            <asp:Repeater ID="rptAds" runat="server">
                <ItemTemplate>
                    <div class="rightbar_innerblock">
                        <a href='<%#ResolveUrl(Eval("Url").ToString()) %>' target="_blank">
                            <img src='<%#ResolveUrl(Eval("Image").ToString()) %>' width="100%" border="0" alt='<%#Eval("AdName").ToString() %>' /></a>
                    </div>
                </ItemTemplate>
            </asp:Repeater>
        </div>
    </div>
</asp:Content>

